package Fulbito.SERVLET;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Fulbito.EXCEPCION.DAOExcepcion;

import Fulbito.EXCEPCION.DAOExcepcion;
import Fulbito.MODELO.Local;
import Fulbito.NEGOCIO.LocalNEG;

/**
 * Servlet implementation class ServletCambo
 */
@WebServlet("/ServletCambo")
public class ServletCambo extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ServletCambo() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		LocalNEG ablLocal = new LocalNEG();
	
		Collection<Local> local = new ArrayList<Local>();
		
	    try {
	    	
	    	int Distrito_CodDistrito  = Integer.parseInt(request.getParameter("cboDistrito_CodDistrito"));
	    	local = ablLocal.ListarCombo(Distrito_CodDistrito);
	    	request.setAttribute("ListadoLocal",local);
		} catch (DAOExcepcion e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
				
	/////***esto debe de ir en el login***/// 
		//HttpSession session = request.getSession();
		//session.setAttribute("codUsuario", 1); 
		//////********************////////////// 
		RequestDispatcher rd = request.getRequestDispatcher(
		"BusquedaReserva.jsp"); 
		rd.forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
